package com.csd.activity;

import android.app.ActionBar;
import android.app.Activity;
import android.app.ActionBar.LayoutParams;
import android.content.Intent;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.AnimationSet;
import android.view.animation.TranslateAnimation;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

/**
 * 
 *我的账户
 */
public class AccountActivity extends Activity implements OnClickListener{

	private LinearLayout ll_detail,ll_more,ll_pay;
	private Button bt_pay,bt_cancel,bt_sure;
	private ActionBar actionBar;
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_account);
		initView();
		initActionBar();
	}

	private void initActionBar() {
		// TODO Auto-generated method stub
		actionBar = getActionBar();
		actionBar.setDisplayHomeAsUpEnabled(false);
		actionBar.setDisplayShowHomeEnabled(false);
		actionBar.setDisplayShowTitleEnabled(false);
		actionBar.setDisplayShowCustomEnabled(true);

		LayoutInflater inflator = (LayoutInflater) getSystemService(this.LAYOUT_INFLATER_SERVICE);

		View v = inflator.inflate(R.layout.actionbar_main, null);
		TextView title = (TextView) v.findViewById(R.id.title);
		title.setText("员工信息");
		ImageView img = (ImageView) v.findViewById(R.id.logo);
		img.setImageDrawable(getResources().getDrawable(R.drawable.u86));
		img.setOnClickListener(this);
		ActionBar.LayoutParams layout = new ActionBar.LayoutParams(
				LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
		actionBar.setCustomView(v, layout);

	}


	private void initView() {
		// TODO Auto-generated method stub
		ll_detail = (LinearLayout) findViewById(R.id.detail);
		ll_detail.setOnClickListener(this);
		ll_more = (LinearLayout) findViewById(R.id.more);
		ll_more.setOnClickListener(this);
		ll_pay = (LinearLayout) findViewById(R.id.ll_pay);
		bt_pay = (Button) findViewById(R.id.pay);
		bt_pay.setOnClickListener(this);
		bt_cancel = (Button) findViewById(R.id.cancle);
		bt_sure = (Button) findViewById(R.id.sure);
		bt_cancel.setOnClickListener(this);
		bt_sure.setOnClickListener(this);
		
		
	}

	@Override
	public void onClick(View v) {
		// TODO Auto-generated method stub
		switch (v.getId()) {
		case R.id.detail:
			Intent intent = new Intent(AccountActivity.this,PersonalDetailActivity.class);
			startActivity(intent);
			
			break;
		case R.id.more:
			Intent intent1 = new Intent(AccountActivity.this, MoreRecoderActivity.class);
			startActivity(intent1);
			break;
		case R.id.pay:
			CsdApplication.showContent(ll_pay, this);
			break;
		case R.id.cancle:
			ll_pay.setVisibility(View.GONE);
			break;
		case R.id.sure:
			ll_pay.setVisibility(View.GONE);
			break;
		case R.id.logo:
			finish();
			break;
		default:
			break;
		}
	}
}
